<template>
  <div class="swiper-wrap">
    <swiper :options="swiperOtions">
      <swiper-slide
        v-for="(item, index) of picDatas"
        :key="index"
      >
        <img class="swiper-img" :src="item" />
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
// 引入swiper中的组件(注意组件名字的大小)
import { swiper, swiperSlide } from 'vue-awesome-swiper';
import "swiper/dist/css/swiper.css";

export default {
  name: 'Swiper',
  components: {
    swiper,
    swiperSlide
  },
  props: {
    picDatas: Array
  },
  data () {
    return {
      swiperOtions: {
        pagination: {          
          el: ".swiper-pagination" // 引入pagination的选择器，如果是clas则需要加上.
        }
      }
    }
  }
}
</script>

<style lang='scss' scoped>
@import '~styles/variables.scss';

.swiper-wrap >>> .swiper-pagination-bullet-active {
  background: $defaultGreen;
}

.swiper-slide {
  height: 2rem;
}

.swiper-img {
  width: 100%;
  height: 100%;
}
</style>